package com.sky.pay.service;

import com.sky.pay.api.request.RefundRequest;
import com.sky.pay.api.request.WeixinPayOrderRequest;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;
import java.util.HashMap;
import java.util.Map;

/**
 * @author yangsk
 */
public interface WeixinPayService {

    /**
     * 微信native支付的方式，调用统一下单生成微信支付单
     * @param request
     * @return
     */
    Map<String, Object> nativePay(WeixinPayOrderRequest request) throws Exception;

    /**
     * 对请求体中的参数进行解密
     * @param resultBody
     * @return
     */
    String decryptFromBodyResource(HashMap<String, Object> resultBody) throws UnsupportedEncodingException, GeneralSecurityException;

    /**
     * 生成商家和微信的交易记录
     * @param plainText
     */
    void createTradeRecord(String plainText);

    /**
     * jsapi的支付方式
     * @param request
     * @return
     */

    /**
     * 用户主动取消订单
     * @param orderNo
     */
    void cancleOrder(String orderNo) throws Exception;

    /**
     * 商家查询微信的交易单
     * @param orderNo
     */
    String queryOrder(String orderNo) throws IOException;

    /**
     * 查看微信交易单状态
     * @param orderNo
     */
    void checkWeixinPayOrderStatus(String orderNo) throws Exception;

    /**
     * 用户退款
     * @param request
     */
    void refund(RefundRequest request) throws IOException;

    /**
     * 查询未退款的订单
     * @param refundNo
     */
    String getQueryRefund(String refundNo) throws IOException;

    /**
     * 定时检查退款单状态
     * @param refundNo
     */
    void checkWeixinRefundOrderStatus(String refundNo) throws IOException;
}
